NumberUtils = {
	format : function(value, fixed, prefix, suffix) {
		if (value == null || value.length == 0)
			return '';

		if (suffix != null && suffix.length > 0) {
			if (suffix == '%')
				value = (Number(value) * 100).toFixed(fixed);
			else if (suffix == '‰')
				value = (Number(value) * 1000).toFixed(fixed);
			else
				value = Number(value).toFixed(fixed);
		} else {
			value = Number(value).toFixed(fixed);
		}

		var dotIndex = value.indexOf('.');
		if (dotIndex == -1)
			dotIndex = value.length;

		var integer = value.substring(0, dotIndex);
		if (integer.length <= 3) {
			return NumberUtils.addPrefixAndSuffix(value, prefix, suffix);
		}

		var result = '';
		while (integer.length > 3) {
			var startIndex = integer.length - 3;
			var endIndex = integer.length;

			if (result != null && result.length > 0)
				result = ',' + result;

			result = integer.substring(startIndex, endIndex) + result;
			integer = integer.substring(0, startIndex);
		}

		result = integer + ',' + result;
		result += value.substring(dotIndex);
		
		return NumberUtils.addPrefixAndSuffix(result, prefix, suffix);
	},

	addPrefixAndSuffix : function(value, prefix, suffix) {
		var result = value;
		if (prefix != null && prefix.length > 0)
			result = prefix + result;

		if (suffix != null && suffix.length > 0)
			result += ' ' + suffix;

		return result;
	},
	toFixed:function(number, precision) {
	    var str = number + ''
	    var len = str.length
	    var last = str.substr(len-1, len)
	    if (last == '5') {
	        last = '6'
	        str = str.substr(0, len-1) + last
	        return (str - 0).toFixed(precision)       
	    } else {
	        return number.toFixed(precision)
	    }
	}
};